<?php
/**
* @version $Id: mod_holidaygreetings.php 5203 2006-09-27 02:45:14Z JinxDanr $
* @package Joomla
* @copyright Copyright (C) 2007 Dan Rahmel. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* This is a module to display a holiday greetings on the proper day.
*/

class JElementFields extends JElement {

  var   $_name = 'fields';

  function fetchElement($name, $value, &$node, $control_name)
  {
    $db = &JFactory::getDBO();

    $section  = $node->attributes('section');
    $class    = $node->attributes('class');
    if (!$class) {
      $class = "inputbox";
    }

    if (!isset ($section)) {
      // alias for section
      $section = $node->attributes('scope');
      if (!isset ($section)) {
        $section = 'content';
      }
    }



$query = "SELECT a.fieldid as value, b.langValue as text FROM #__sobi2_fields as a INNER JOIN #__sobi2_language as b ON a.fieldid=b.fieldid WHERE a.enabled = 1 ORDER BY b.langValue";

$db->setQuery($query);
$fields = $db->loadObjectList();



  
    return JHTML::_('select.genericlist',  $fields, ''.$control_name.'['.$name.'][]','class="inputbox" size="15" multiple="multiple"','value', 'text', $value, $control_name.$name);
  
  }
}

?>